/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.lodz.p.ftims.ProjektZespolowy2.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Łukasz Gadomski
 */
@Entity
@Table(name = "doctors_spec_rltd")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DoctorsSpecRltd.findAll", query = "SELECT d FROM DoctorsSpecRltd d"),
    @NamedQuery(name = "DoctorsSpecRltd.findById", query = "SELECT d FROM DoctorsSpecRltd d WHERE d.id = :id"),
    @NamedQuery(name = "DoctorsSpecRltd.findByActive", query = "SELECT d FROM DoctorsSpecRltd d WHERE d.active = :active")})
public class DoctorsSpecRltd implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "active")
    private boolean active;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false)
    private User userId;
    @JoinColumn(name = "spec_id", referencedColumnName = "spec_id")
    @ManyToOne(optional = false)
    private Specialization specId;

    public DoctorsSpecRltd() {
    }

    public DoctorsSpecRltd(Integer id) {
        this.id = id;
    }

    public DoctorsSpecRltd(Integer id, boolean active) {
        this.id = id;
        this.active = active;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public User getUserId() {
        return userId;
    }

    public void setUserId(User userId) {
        this.userId = userId;
    }

    public Specialization getSpecId() {
        return specId;
    }

    public void setSpecId(Specialization specId) {
        this.specId = specId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DoctorsSpecRltd)) {
            return false;
        }
        DoctorsSpecRltd other = (DoctorsSpecRltd) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pl.lodz.p.ftims.ProjektZespolowy2.entities.DoctorsSpecRltd[ id=" + id + " ]";
    }
    
}
